﻿using System;

namespace Nofs.Net.nofs.stocks
{

    //@DomainObject(CanWrite=false)
    public class Stock
    {
        private String _symbol;
        private String _data = null;
        /*private String _price;
        private String _date;
        private String _time;
        private String _diff;*/

        public Stock() { }

        public Stock(String ticker)
        {
            _symbol = ticker;
        }

        //@ProvidesName
        public String getTicker()
        {
            return _symbol;
        }

        //@ProvidesName
        public void setTicker(String symbol)
        {
            _symbol = symbol;
        }

        public void UpdateData(String data)
        {
            _data = data;
        }

        public String getPrice()
        {
            return _data == null ? "unknown" : _data.Split(',')[1];
        }

        public String getDate()
        {
            return _data == null ? "unknown" : _data.Split(',')[2].Replace("\"", "");
        }

        public String getTime()
        {
            return _data == null ? "unknown" : _data.Split(',')[3].Replace("\"", "");
        }

        public String getDiff()
        {
            return _data == null ? "unknown" : _data.Split(',')[4];
        }
    }
}
